Emacs 對於 C# 程式語言的支援有
需先安裝 .NET SDK (https://www.microsoft.com/net/download)
(use-package csharp-mode
:ensure t)
(use-package omnisharp
:ensure t
:hook ((csharp-mode . omnisharp-mode)
(before-save . omnisharp-code-format-entire-file))
:config
(local-set-key (kbd "\C-c o s") 'omnisharp-start-omnisharp-server)
(local-set-key (kbd "\C-c o j") 'omnisharp-go-to-definition)
(local-set-key (kbd "\C-c o w") 'omnisharp-go-to-definition-other-window)
(local-set-key (kbd "\C-c o f") 'omnisharp-find-usages)
(add-hook 'omnisharp-mode-hook (lambda ()
(add-to-list (make-local-variable 'company-backends)
'(company-omnisharp))))
)
建立 omnisharp-mode 為 csharp-mode 的次模式,在檔案儲存前執行 omnisharp-code-format-entire-file
來排版美化程式
建立一些常用的組合鍵來啟動 omnisharp-server, 跳到函式定義,跟顯示函式變數的使用情況 (find usages)
程式補全 Company-backends 設定為 company-omnisharp
相關簡報:簡報
相關程式: Github
相關資訊:我的部落格